package net.gamebookengine.viewer.helper;

import java.util.Date;

import net.gamebookengine.viewer.R;
import net.gamebookengine.viewer.R.string;

import android.content.Context;
import android.widget.Toast;

public abstract class ToastHelper
{
	private static long	lastToast	= 0;
	
	public static void toastOneway(Context context, int toastTextResId)
	{
		long now = new Date().getTime() / 1000;
		
		if (now - lastToast > 2)
		{
			lastToast = now;
			Toast.makeText(context, toastTextResId, Toast.LENGTH_SHORT).show();
		}
	}
	
	public static boolean toastDoubleFinish(Context context)
	{
		boolean result = false;
		
		long now = new Date().getTime() / 1000;
		
		if (now - lastToast > 2)
		{
			lastToast = now;
			Toast.makeText(context, R.string.toast_text_press_again_to_exit, Toast.LENGTH_SHORT).show();
		}
		else
		{
			result = true;
		}
		
		return result;
	}
}
